function myAjax (url) {
  return new Promise(function (resolve, reject) {
    var xhr = new XMLHttpRequest()
    xhr.onreadystatechange = function () {
      if (this.readyState == 4) {
        if (this.status == 200) {
          // 成功的回调
          resolve(this.responseText)
        } else {
          reject(new Error())
        }
      }
    }
    xhr.open('get', url)
    xhr.send()
  })
}
